<%@ page pageEncoding="UTF-8" contentType="text/html; charset=UTF-8"%>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<!DOCTYPE html>

<html>
    <head>
    <script>
    	if(document.domain.toString().indexOf("qronet.co.kr") != -1)
			document.domain = 'qronet.co.kr'; 
	</script>
    <%@ include file="/WEB-INF/views/include/common.jsp" %>
    
    
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<link href="/resources/css/Qronet_display.css" rel="stylesheet" media="screen" />
    <title>sub4_3_1</title>
    </head>
    <body onload="init()">
    	<div class="content" id="menu4-content3">
    			<div class="sub4_header"><img src="${imgUrl}/QronetHomeImages/sub4-3-1-header.png"></div>
    			<div class="sub4_3_1content">
    				<p class="sub4_3_1content_p_comment1">고객님의 궁금하신 점을 등록하여 주시면 빠른 시간 내에 답변을 드릴 수 있도록 하겠습니다.</p>
    				<p class="sub4_3_1content_p_comment2"><img src="${imgUrl}/QronetHomeImages/orange-comment.png">이미 가입하신 고객께서는 <a href="">관제시스템의 고객지원</a>을 이용하시면 보다 신속하게 지원을 받으실 수 있습니다.</p>
    				<form name="theForm" id="theForm" method="post">
    				<input type="hidden" name="receiver" value="qrolbs@gmail.com">
    				<div class="table_wrapper"> 
    					<table class="sub4_table" cellpadding="0" cellspacing="0">
    						<tr>
    							<th>* 성명</th>
    							<td><input type="text" style="width:89px;" name="name" id="name"></td>
    						</tr>
    						<tr>
    							<th>회사명</th>
    							<td><input type="text" name="companyName" id="companyName"></td>
    						</tr>
    						<tr>
    							<th>* 전화번호</th>
    							<td><input type="text" name="phone" id="phone"> 연락받으실 수 있는 전화번호를 입력해주세요.</td>
    						</tr>
    						<tr>
    							<th>이메일</th>
    							<td><input type="text" name="email" id="email"></td>
    						</tr>
    						<tr>
    							<th>* 문의 종류</th>
    							<td>
    								<input type="radio" name="type" value="가입관련문의" checked> 가입관련문의
    								<input type="radio" name="type" value="기술관련문의"> 기술관련문의
    							</td>
    						</tr>
    						<tr>
    							<th>* 내용</th>
    							<td><textarea name="contents" id="contents"></textarea></td>
    						</tr>
    						
    					</table>
    					<div class="charBox">
    						<p style="margin:15px 0 5px 0;">아래 이미지를 보이는 대로 입력해주세요.</p>
    						<div class="chardir">
    							<div class="chars"><img id="randomImg" src="${imgUrl}/QronetHomeImages/capcha/key_01.png"></div>
    							<div class="charsinput">
    								<p style="height:18px;"><a onClick="getRandomImg()"><img src="${imgUrl}/QronetHomeImages/new-character.png"><span>새로고침</span></a></p>
    								<p><input type="text" id="randomValue"></p>
    								<input type="hidden" id="originRandomValue">
    							</div>
    						</div>
    					</div>
    					<div class="submitButton"><a onClick="sendMail()">문의하기</a></div>
    				</div><!--table wrapper-->
    				</form>
    			</div>
    			<div class="sub4_footer">COPYRIGHT(C) QROTECH ALL RIGHTS RESERVED.</div>
    		</div><!--sub4-3 end-->
    		
    		<script language="javascript">
    			function init() {
    				getRandomImg();
    			}
    			function sendMail() {
    				if(validationCheck()) {
	    				try{
	    		    		var url="sendMail.json";
	    		    		var param = $("#theForm").serialize();
	    		    		AjaxPost(url, param, function(data){
	    	    				 alert(data.msg);
	    		    		});
	    		    	}catch(e){
	    		    		//logs(e);
	    		    	}
    				}
    			}
    			function validationCheck() {
    				if($("#name").val() == '') {
    					alert('성명을 입력하세요.');
    					$("#name").focus();
    					return false;
    				}
    				
    				if($("#phone").val() == '') {
    					alert('전화번호를 입력하세요.');
    					$("#phone").focus();
    					return false;
    				}
    				
    				if($("#contents").val() == ''){
    					alert('내용을 입력하세요.');
    					$("#contents").focus();
    					return false;
    				}
    				
    				if($("#randomValue").val() == '') {
    					alert('문자를 입력해주세요.');
    					$("#randomValue").focus();
    					return false;
    				}
    				
    				if($("#randomValue").val() != $("#originRandomValue").val()) {
    					alert('문자를 확인해주세요.');
    					$("#randomValue").focus();
    					return false;
    				} 
    				return true;
    			}
    			
    			function getRandomImg() {
    				var url='/homepage/getRanImgValue.json';
    				var param = "";
    				var rtnVal = "";
    		 		AjaxPost(url, param, function(data){
    		 			rtnVal = data.key;
    		 			if(rtnVal < 10) {
    		 				rtnVal = "0"+data.key;
    		 			}
    		 			$("#randomImg").attr("src", "${imgUrl}/QronetHomeImages/capcha/key_"+rtnVal+".png");
    		 			$("#originRandomValue").val(data.value);
    		 		});
    			}
    		</script>
    </body>
</html>